package com.shux.common.exception;
/**
 **********************************************
 *  描述：
 * Simba.Hua
 * 2017年5月30日
 **********************************************
**/
public class ShuxRunTimeException extends RuntimeException {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    public ShuxRunTimeException(String string) {
        super(string);
    }

    public ShuxRunTimeException(String msg, Object ... param) {
        super(messageHandler(msg,param));
    }

    public ShuxRunTimeException() {
        super();
        // TODO Auto-generated constructor stub
    }

    public ShuxRunTimeException(String message, Throwable cause, boolean enableSuppression,
            boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        // TODO Auto-generated constructor stub
    }

    public ShuxRunTimeException(String message, Throwable cause) {
        super(message, cause);
        // TODO Auto-generated constructor stub
    }

    public ShuxRunTimeException(Throwable cause) {
        super(cause);
        // TODO Auto-generated constructor stub
    }

    private static String messageHandler(String msg, Object ... param){
        for(int i=0;i<param.length;i++){
            msg = msg.replaceFirst("{}", String.valueOf(param[i]));
        }
        return msg;
    }

}
